﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ElingOA6_DSJCJ.Model
{
   /// <summary>
	/// 相册主表
	/// </summary>
	[Serializable]
	public partial class Album
	{
		public Album()
		{
			
			FSize=0;
			FIsDelete=0;
			FIsDeptControl=0;
			FPlayInterval=6;
		}
		#region Model
		/// <summary>
		/// 文档编号
		/// </summary>
		public int FAlbumId
		{
			set;
			get;
		}
		/// <summary>
		/// 员工编号
		/// </summary>
		public string FEmplNo
		{
			set;
			get;
		}
		/// <summary>
		/// 公司编码
		/// </summary>
		public string FEntityNo
		{
			set;
			get;
		}
		/// <summary>
		/// 文件名
		/// </summary>
		public string FFileName
		{
			set;
			get;
		}
		/// <summary>
		/// 文件类型
		/// ALBUM  相册
		/// VIDEO    视频
		/// </summary>
		public string FFileType
		{
			set;
			get;
		}
		/// <summary>
		/// 文件链接地址
		/// </summary>
		public string FFileUrl
		{
			set;
			get;
		}
		/// <summary>
		/// 文件存放路径
		/// </summary>
		public string FFilePath
		{
			set;
			get;
		}
		/// <summary>
		/// 创建日期
		/// </summary>
		public DateTime FCreateDate
		{
			set;
			get;
		}
		/// <summary>
		/// 文档更新时间
		/// </summary>
		public DateTime? FUpdateTime
		{
			set;
			get;
		}
		/// <summary>
		/// 显示次序
		/// </summary>
		public int? FDispSeq
		{
			set;
			get;
		}
		/// <summary>
		/// 部门编号
		/// </summary>
		public string FDeptNo
		{
			set;
			get;
		}
		/// <summary>
		/// 文件大小（字节）
		/// </summary>
		public long FSize
		{
			set;
			get;
		}
		/// <summary>
		/// 是否删除
		/// </summary>
		public int FIsDelete
		{
			set;
			get;
		}
		/// <summary>
		/// 文档内容（文本）
		/// 存放相册或视频的描述
		/// </summary>
		public string FContentTxt
		{
			set;
			get;
		}
		/// <summary>
		/// 文档内容（二进制）
		/// 存放相册或视频的缩略图
		/// </summary>
		public byte[] FContentBin
		{
			set;
			get;
		}
		/// <summary>
		/// 相册背景音乐地址
		/// </summary>
		public string FBGMusicPath
		{
			set;
			get;
		}
		/// <summary>
		/// 责任者
		/// </summary>
		public string FResponsible
		{
			set;
			get;
		}
		/// <summary>
		/// 是否本部门查看控制
		/// </summary>
		public int? FIsDeptControl
		{
			set;
			get;
		}
		/// <summary>
		/// 相册播放时间间隔
		/// </summary>
		public int FPlayInterval
		{
			set;
			get;
		}
		/// <summary>
		/// 显示日期
		/// </summary>
		public DateTime? FShowDate
		{
			set;
			get;
		}
		/// <summary>
		/// 是否涉密文件
		/// Y 涉密
		/// N 不涉密
        /// Null或空为不涉密
		/// </summary>
		public string FIsSecret
		{
			set;
			get;
		}
		/// <summary>
		/// 文号
		/// </summary>
		public string FFileNo
		{
			set;
			get;
		}
		/// <summary>
		/// 发文日期
		/// </summary>
		public DateTime? FFileNoDate
		{
			set;
			get;
		}
		/// <summary>
		/// 相册类别编码
		/// </summary>
		public string FAlbumClsNo
		{
			set;
			get;
		}
		#endregion Model

        /// <summary>
        /// 文件自定义类型,区分是office文件和其他文件,1表示office文件,2表示其他文件
        /// </summary>
        public string FSelftype
        {
            get
            {

                string _type = "2";
                string _lowfiletype = FFileType.ToLower();
                int dotindex = FFileName.LastIndexOf('.');
                string backname = FFileName.Substring(dotindex + 1).ToLower();
                if (_lowfiletype.Contains("ms-excel") || _lowfiletype.Contains("msword") || _lowfiletype.Contains("ms-powerpoint") ||
                    _lowfiletype.Contains("word.document") || _lowfiletype.Contains("excel.sheet") || _lowfiletype.Contains("powerpoint.show") ||
                    _lowfiletype.Contains("document") || _lowfiletype.Contains("sheet") || _lowfiletype.Contains("presentation"))
                {
                    _type = "1";
                }
                else if (backname == "doc" || backname == "docx" || backname == "xls" || backname == "xlsx" || backname == "ppt"
                            || backname == "pptx")
                {
                    _type = "1";
                }
                else if (FFileType == "ALBUM")//相册
                {
                    _type = "3";
                }
                else if (FFileType == "HTML")//html
                {
                    _type = "4";
                }
                else if (backname == "flv")//视频
                {
                    _type = "5";
                }
                else if (FFileType == "MUSIC")//音频
                {
                    _type = "6";
                }
                return _type;
            }

        }


        public string DirPath { get; set; }

        public string FSizeStr
        {
            get
            {
                string _fsizestr = "";
                decimal _size = Math.Round((decimal)FSize / 1024, 2);

                if (_size <= 1024)
                {

                    _fsizestr = _size + "K";
                }
                else
                {
                    if (_size <= 1024 * 1024)
                    {
                        _size = Math.Round((decimal)FSize / 1024 / 1024, 2);
                        _fsizestr = _size + "M";
                    }
                    else
                    {
                        if (_size <= 1024 * 1024 * 1024)
                        {
                            _size = Math.Round((decimal)FSize / 1024 / 1024 / 1024, 2);
                            _fsizestr = _size + "G";
                        }
                        else
                        {
                            _size = Math.Round((decimal)FSize / 1024 / 1024 / 1024, 2);
                            _fsizestr = _size + "G";
                        }
                    }
                }


                return _fsizestr;

            }
        }
        public string FUpdateTimeStr
        {
            get
            {
                if (FUpdateTime.HasValue)
                {
                    return string.Format("{0:yyyy-MM-dd}", FUpdateTime.Value);

                }
                else
                {
                    return "";
                }
            }
        }

        public string FEmpName { get; set; }

	}
}
